﻿using System;
using System.Collections.Generic;
using System.Web;
using System.Data;
using System.Data.SqlClient;

/// <summary>
/// Summary description for clsNHATKY_RUTPHI
/// </summary>
public class clsNHATKY_RUTPHI
{
	public clsNHATKY_RUTPHI()
	{
		//
		// TODO: Add constructor logic here
		//
	}
    #region Select
    public static DataTable Select()
    {
        DataTable dt = new DataTable();
        // Tham so
        DatabaseConnect connect = new DatabaseConnect();
        try
        {
            dt = connect.GetSelectCommand("NHATKYRUTPHI_Select", null);
        }
        catch { }
        return dt;
    }
    public static DataTable GetByF_MACN(string F_MACN)
    {
        DataTable dt = new DataTable();
        DatabaseConnect connect = new DatabaseConnect();
        SqlParameter[] para = new SqlParameter[1];
        para[0] = new SqlParameter("@F_MACN", F_MACN);
        try
        {
            dt = connect.GetSelectCommand("NHATKYRUTPHI_GetByF_MACN", para);
        }
        catch { }
        return dt;
    }
    #endregion

    #region Insert
    public static string Insert(Guid F_STT)
    {
        DatabaseConnect connect = new DatabaseConnect();
        // Tham so
        object[] values = { F_STT };
        string[] parameters = { "@F_STT" };
        SqlParameter[] para = new SqlParameter[parameters.Length];
        for (int i = 0; i < parameters.Length; i++)
        {
            para[i] = new SqlParameter(parameters[i], values[i]);
        }
        try
        {
            connect.ExecuteQuery("NHATKYRUTPHI_Insert", para);
            return "OK";
        }
        catch
        {
            return "ERR";
        }
    }
    #endregion

    public static string Duyet(int F_SYS_ID, int F_NGUOIDUYET)
    {
        DatabaseConnect connect = new DatabaseConnect();
        SqlParameter[] para = new SqlParameter[2];
        para[0] = new SqlParameter("@F_SYS_ID", F_SYS_ID);
        para[1] = new SqlParameter("@F_NGUOIDUYET", F_NGUOIDUYET);
        try
        {
            connect.ExecuteQuery("NHATKY_RUTPHI_Duyet", para);
            return "OK";
        }
        catch
        {
            return "ERR";
        }
    }

    #region Delete
    //public static string Delete(int F_SYS_ID)
    //{
    //    DatabaseConnect connect = new DatabaseConnect();
    //    SqlParameter[] para = new SqlParameter[1];
    //    para[0] = new SqlParameter("@F_SYS_ID", F_SYS_ID);
    //    try
    //    {
    //        connect.ExecuteQuery("NHATKY_RUTPHI_Delete", para);
    //        return "OK";
    //    }
    //    catch
    //    {
    //        return "ERR";
    //    }
    //}
    #endregion

    #region DeleteAll
    //public static string DeleteAll()
    //{
    //    DatabaseConnect connect = new DatabaseConnect();
    //    try
    //    {
    //        connect.ExecuteQuery("NHATKY_XOAPHI_DeleteAll", null);
    //        return "OK";
    //    }
    //    catch
    //    {
    //        return "ERR";
    //    }
    //}
    #endregion
}